<template>
  <div>
<ul>
  <li v-for="(item,index) in arr" :key="index">
    {{item}}
    <button @click="delFn(index)">删除</button>
    </li>
</ul>
<button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [1, 2, 5, 6]
    }
  },

  created () {

  },

  methods: {
    addFn () {
      this.arr.push((Math.random() * 100).toFixed(0))
    },
    delFn (ind) {
      this.arr.splice(ind, 1)
    }
  }
}
</script>

<style scoped lang='less'>

</style>
